<?php use_helper('Javascript') ?> 
<table>
    <td width="390">
<h1>Lista de Trabajos</h1>
<table id= "Filtro" width="390">
      <thead>
	     <tr>
	        <th><label for ="Filtro">Filtro de Busqueda </label></th>
                <th ><input size="35" type="text" id="Filtro" value="" onkeyup="filtra(this.value,'ListaDeFallas')"> </th>
	     </tr> 
	  </thead>
   </table>
<table cellspacing="0" id = "ListaDeFallas" width="390">
   <thead colspan="9">
    <tr>
      <th id="sf_admin_list_batch_actions"><input id="sf_admin_list_batch_checkbox" type="checkbox" onclick="checkAll();" ></th>
	  <th class="sf_admin_text sf_admin_list_th_item"><h4>  Item  </h4></th>
      <th class="sf_admin_text sf_admin_list_th_falla"><h4>  Falla </h4></th>
	<th class="sf_admin_text sf_admin_list_th_Observacion"><h4>  Observaciones </h4></th>
      <th class="sf_admin_text sf_admin_list_th_Acciones"><h4>  Acciones</h4></th>
      
    </tr>
  </thead>
<tbody>   
<?php $e = 1; foreach ($lista_fallas_aagregar as $Fallas):?>
	   <tr>
	      <?php include_partial('list_td_batch_actions',array('Fallas'=> $Fallas))?>
		   <td class="sf_admin_text sf_admin_list_td_item"><?php echo $e?></td>
		   <td class="sf_admin_text sf_admin_list_td_falla"><?php echo $Fallas->getDescripcionFalla()?></td>
                   <td class="sf_admin_text sf_admin_list_td_falla"><input type="text" id ="Observaciones"> </td>
                   <td class="sf_admin_text"><?php echo link_to_remote('Agregar',array(
		                                        'update' => array('success' => 'Actualizar', 'failure' => 'error'),
                                                        'url'    => url_for('detalleservicios/Agregar?ingresoid='.$ingresoid.'&ids='.$Fallas->getId())
							)
						)?>
			</td>
	   </tr>

<?php $e++; endforeach; ?>
     	</tbody>
</table>
</td>
<td width="390">
<h1>Lista de Trabajos A Realizar</h1>
<table id= "Filtro" width="390">
      <thead>
	     <tr>
	        <th><label for ="Filtro">Filtro de Busqueda </label></th>
                <th><input size="35" type="text" id="Filtro" value="" onkeyup="filtra(this.value,'ListaDeTrabajos')"> </th>
	     </tr> 
	  </thead>
</table>
 <table cellspacing="0" id = "ListaDeTrabajos">
   <thead colspan="9">
    <tr>
      <th id="sf_admin_list_batch_actions"><input id="sf_admin_list_batch_checkbox2" type="checkbox" onclick="checkAll2();" /></th>	  
      <th class="sf_admin_text sf_admin_list_th_item"><h4>  Item  </h4></th>
      <th class="sf_admin_text sf_admin_list_th_falla"><h4>  Falla </h4></th>
      <th class="sf_admin_text sf_admin_list_th_falla"><h4>  Observaciones </h4></th>
      <th class="sf_admin_text sf_admin_list_th_Acciones"><h4>  Acciones</h4></th>
    </tr>
  </thead>
<tbody>   
<?php $e = 1; foreach ($lista_fallas_equipo as $Actuales):?>
	<tr>
	       <?php include_partial('list_td_batch_actions2',array('Fallas'=> $Actuales))?>
		   <td class="sf_admin_text sf_admin_list_td_item"><?php echo $e?></td>
		   <td class="sf_admin_text sf_admin_list_td_falla"><?php echo $Actuales->getListadefallasytrabajos()?></td>
                   <td class="sf_admin_text "> <?php echo $Actuales->getObservaciones() ?> </td>
                   <td class="sf_admin_text sf_admin_list_td_Accion"><?php echo Link_to_remote('Borrar', array(
		                                                                'update' => 'Actualizar',
										'url' => url_for('detalleservicios/borrar?ingresoid='.$ingresoid.'&'.'ids='.$Actuales->getId()),
                                                                                'confirm' => 'Esta Seguro?'
															                                           )
																		)
											                  ?>
			</td>
       </tr>

<?php $e++; endforeach; ?>

</tbody>
</table>

</table>



<script type="text/javascript">
/* <![CDATA[ */
function checkAll()
{
  var boxes = document.getElementsByTagName('input'); for(var index = 0; index < boxes.length; index++) { box = boxes[index]; if (box.type == 'checkbox' && box.className == 'sf_admin_batch_checkbox') box.checked = document.getElementById('sf_admin_list_batch_checkbox').checked } return true;
}
function checkAll2()
{
   var boxes = document.getElementsByTagName('input'); for(var index = 0; index < boxes.length; index++) { box = boxes[index]; if (box.type == 'checkbox' && box.className == 'sf_admin_batch_checkbox2') box.checked = document.getElementById('sf_admin_list_batch_checkbox2').checked } return true;
}
// Codigo para Filtrado de texto

var colum=2;
function filtra(txt,tabla) {
  t = document.getElementById(tabla);
  filas = t.getElementsByTagName('tr');
  for (i=1; filas; i++) {
    ele=filas[i]
	texto = ele.getElementsByTagName('td')[colum].innerHTML.toUpperCase();
    //for (j=0; ra=document.forms[0].rad[j]; j++) // Comprobar radio seleccionado
    //  if (ra.checked) num = j;

    //if (num==0) posi = (texto.indexOf(txt.toUpperCase()) == 0);
    //else if (num==1) posi = (texto.lastIndexOf(txt.toUpperCase()) == texto.length-txt.length);
    //else el texto presedido Iba aqui
	posi = (texto.indexOf(txt.toUpperCase()) != -1);
    ele.style.display = (posi) ? '' : 'none';
  }
}




/* ]]> */
</script>